<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>修改医生信息</title>

    <!-- Bootstrap -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <style>
        #form {
            padding-right: 100px;
            margin-top: 300px;
            width: 40%;
        }

        #image {
            padding-left: 100px;
            padding-top: 100px;
        }

        a:link {
            text-decoration: none;
            color: black;
        }
    </style>
</head>
<body background="img/background.jpg">
<div class="row">
    <img class="col-md-6" id="image" src="img/pregnant.svg"/>
    <div background-color="width" class="col-md-6" id="form">
        <div class="form-group">
            <label for="exampleInputEmail1">医生ID</label>
            <input class="form-control" id="id" placeholder="text" required="required" type="text"/>
        </div>
        <div class="form-group">
            <label for="exampleInputEmail1">修改手机号</label>
            <input class="form-control" id="phone" placeholder="text" required="required" type="text"/>
        </div>
        <div>
            <button class="btn btn-default" onclick="window.location.href='/'" type="submit">返回</button>
            <button class="btn btn-default" id="submit" onclick="return false;" type="submit">提交</button>
        </div>

    </div>
</div>

<script>
    function createUser() {
        var user = new Object;
        user.id = null;
        user.birthday = null;
        user.gender = null;
        user.phone = null;
        user.phone2 = null;
        user.email = null;
        user.password = null;
        user.loginState = null;
        user.inService = null;
        user.admin = null;
        user.sessionId = null;
        user.name = null;
        return user;
    }

    var User = createUser();

    $(document).ready(function () {
        $("#submit").click(function () {
            User.id = $("#id").val();
            User.phone = $("#phone").val();
            // $("#form").hide();
            // console.log('12312312')
            $.post("/updateUser",
                User,
                function (data, status) {
                    if (status == "success") {
                        alert("修改手机号成功\n" + "请返回查询医生页面进行查询！");
                    }
                });
        });
    });
</script>
</body>
</html>
